home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing;
-
- import java.io.Serializable;
- import java.util.Vector;
-
- class JComboBox$DefaultComboBoxModel extends AbstractListModel implements ComboBoxModel, Serializable {
- // $FF: synthetic field
- JComboBox this$0;
- Vector objects;
- Object selectedObject;
-
- // $FF: synthetic method
- public JComboBox$DefaultComboBoxModel(JComboBox this$0) {
- this.this$0 = this$0;
- this.objects = new Vector();
- }
-
- // $FF: synthetic method
- public JComboBox$DefaultComboBoxModel(JComboBox this$0, Object[] items) {
- this.this$0 = this$0;
- this.objects = new Vector();
- int i = 0;
-
- for(int c = items.length; i < c; ++i) {
- this.objects.addElement(items[i]);
- }
-
- }
-
- // $FF: synthetic method
- public JComboBox$DefaultComboBoxModel(JComboBox this$0, Vector v) {
- this.this$0 = this$0;
- this.objects = new Vector();
- int i = 0;
-
- for(int c = v.size(); i < c; ++i) {
- this.objects.addElement(v.elementAt(i));
- }
-
- }
-
- public void setSelectedItem(Object anObject) {
- this.selectedObject = anObject;
- ((AbstractListModel)this).fireContentsChanged(this, -1, -1);
- }
-
- public Object getSelectedItem() {
- return this.selectedObject;
- }
-
- public int getSize() {
- return this.objects.size();
- }
-
- public Object getElementAt(int index) {
- return index >= 0 && index < this.objects.size() ? this.objects.elementAt(index) : null;
- }
-
- public int getIndexOf(Object anObject) {
- return this.objects.indexOf(anObject);
- }
-
- void addObject(Object anObject) {
- this.objects.addElement(anObject);
- ((AbstractListModel)this).fireIntervalAdded(this, this.objects.size() - 1, this.objects.size() - 1);
- }
-
- void insertObjectAt(Object anObject, int index) {
- this.objects.insertElementAt(anObject, index);
- ((AbstractListModel)this).fireIntervalAdded(this, index, index);
- }
-
- void removeObjectAt(int index) {
- this.objects.removeElementAt(index);
- ((AbstractListModel)this).fireIntervalRemoved(this, index, index);
- }
-
- void removeObject(Object anObject) {
- int index = this.objects.indexOf(anObject);
- if (index != -1) {
- this.removeObjectAt(index);
- }
-
- }
-
- void removeAllObjects() {
- int firstIndex = 0;
- int lastIndex = this.objects.size() - 1;
- this.objects.removeAllElements();
- ((AbstractListModel)this).fireIntervalRemoved(this, firstIndex, lastIndex);
- }
- }
-